/** \file   common.h
 *
 *  \brief  This file contains functions, prototypes, structures, macros, constants
 *  shared by multiple applications
 *
 *
 *   Note: N/A
 *
 *  \author     Jiawei Xie
 *
 *  \version    0.1   Created newly for NAVCON
 */



#ifndef _COMMON_H_
#define _COMMON_H_


#ifdef __cplusplus
extern "C"
{
#endif

typedef enum State_pt {
	UNINITIALISED = 0,
	INITIALISED,
	READY,
	PENDING,
	ENABLE,
	DISABLE
}State_t;

typedef enum Sensors_Opmode_t {
	STANDARD_MODE,
	SLEEP_MODE,
	WAKEUP_MODE
}Sensors_Opmode;


typedef struct Sensor_Param_t{
	char name[10];
	int ID;
	int sensor_slave_addr;
	volatile State_t status;
	Sensors_Opmode mode;
	int max_reg_addr;
	int min_reg_addr;
}Sensor_Param;

/*operation modes setting*/
typedef enum opera{
	NORMAL,
	VALIDATE
}op_mode;




/* ========================================================================== */
/*                          Constant Definitions                              */
/* ========================================================================== */
#define PI 3.1415926f
#define DECLINATION 12.53	//Sydney

/* ========================================================================== */
/*                          General Function                                  */
/* ========================================================================== */
void bzeros(unsigned char * buf, int size);
void print_buf(unsigned char * buf, int size);
unsigned int ms_conv_to_tick(int timeout);
void mat_db_to_ft(int size,double mat1[], float mat2[]);	//convert double matrix to float matrix
/* ========================================================================== */
/*                          BIOS related Function                             */
/* ========================================================================== */
GIO_Handle GIO_setup(Int32 *status, String devname, int dir, int nPacket, Ptr chanParams);

#ifdef __cplusplus
}
#endif /* extern "C" */


#endif
